<template lang="pug">
el-dialog(title="授权" :visible="value" width="40%" @close="onComfirm")
  el-tree(:data="permiList" ref="tree" show-checkbox node-key="id" :default-checked-keys="rolePermList")
  el-button(@click="onComfirm") 取消
  el-button(type="primary" @click="onYes") 确定
</template>

<script>
export default {
  props:['permiList','value','rolePermList'],
  data() {
    return {
      isShow:true
    }
  },
  watch: {
    rolePermList() {
      this.isShow = false
      this.$nextTick(() => {
        this.isShow = true
      })
    }
  },
  methods: {
    onComfirm() {
      this.$emit('input',false)
    },
    onYes() {
      console.log(this.$refs.tree);
      const list = this.$refs.tree.getCheckedKeys(true)
      console.log(list);
      this.$emit('onPer',list)
    }
  },
}
</script>
